const mongoose = require('mongoose')

const Schema = mongoose.Schema

const foodSchema = new Schema({
  id: String | Number,
  name: {
    type: String,
    required: true
  },
  img: {
    type: String,
    required: true
  },
  price: {
    type: String,
    required: true
  },
  store: {
    type: String,
    // 1: 表示鸡排店 2: 甜品店
    default: "1",
    isReuired: true
  },

  // 非必须
  catid: {
    type: String,
    required: false
  },
  created_time: {
    type: Date,
    default: Date.now
  },
  last_modified_time: {
    type: Date,
    default: Date.now
  },
  is_hot: {
    type: Number,
    // 1: 表示火热的 0: 不火热
    enum: [1, 0],
    default: 0
  },
  is_show: {
    type: Number,
    // 1: 表示正常 0: 不显示
    enum: [1, 0],
    default: 1
  }
})

module.exports = mongoose.model('Food', foodSchema)